package ex2.grammars;

/**
 * Created with IntelliJ IDEA.
 * User: Roi
 * Date: 11/22/13
 */
public class GrammarFactory {
    /**
     * Creates grammar according to type
     * @param type grammar type
     * @return created grammar
     */
    public static IGrammar createGrammar(GrammarType type) {
        switch (type) {
            case GRAMMAR_TYPE_PROGRAM:
                return new ProgramGrammar();
            case GRAMMAR_TYPE_LIBRARY:
                return new LibraryGrammar();
            default:
                return null;
        }
    }
}
